import { Carousel } from 'antd'

import MessageJump from '@/components/MessageJump'

const BannerNotice = ({ list = [], afterViewMessage }) => {
  if (!(list && list.length > 0)) {
    return null
  }
  return (
    <Carousel style={{ flexGrow: 1, height: 40, width: '100%' }} dotPosition='bottom'>
      {list.map(it => (
        <MessageJump key={it.noticeId} message={it} afterView={afterViewMessage} />
      ))}
    </Carousel>
  )
}

export default BannerNotice
